UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38fc5n84zHZc6dORuLgoBHGT9DOpT6Sfl26V3EAtvho=' 
WHERE 
  key_id = '1db9dfa9c85cb41ac87e7174344e3223149ce3d4a5f5bda8825998f3b548384e' 
  AND (
    token = '38fc5n84zHZc6dORuLgoBHGT9DOpT6Sfl26V3EAtvho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044