UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gODlsUH+P5KRrC+4I7EayHMitdEyMMWj/OhYfacWIs0=' 
WHERE 
  key_id = '9d03091d0f56b18e06190df33121a9c3c10369f20f20630d0b9de8a55341dcd4' 
  AND (
    token = 'gODlsUH+P5KRrC+4I7EayHMitdEyMMWj/OhYfacWIs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038