UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MGogU9SXDiZ7sf5PuVE2srcp9J+6eDzTX5fmHj8xQJ0=' 
WHERE 
  key_id = '9e9bc5ddad88efb76c1ee6f4e02cfc6d8485367b8d172a88f44e48e735dfba03' 
  AND (
    token = 'MGogU9SXDiZ7sf5PuVE2srcp9J+6eDzTX5fmHj8xQJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036