UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7BmurAlC97t8ErsfCuNxfZdliNrsvxnm/E9xQIZYVA=' 
WHERE 
  key_id = '2e160ddbf320fc7474d403b906e36b05b85e8723fc5f7fb60b5a398fee00cbc2' 
  AND (
    token = 'l7BmurAlC97t8ErsfCuNxfZdliNrsvxnm/E9xQIZYVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036