UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4B5kCgikuU81138DjWnR80P0jC34BPsdqgjboX/4uq0=' 
WHERE 
  key_id = 'ef551e14968c854124fb28de2d0e78c13bb2263707ccd346b2fb1610f95198a4' 
  AND (
    token = '4B5kCgikuU81138DjWnR80P0jC34BPsdqgjboX/4uq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033