UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T/N8vYZ2Btg2aGb4tNdeCIyFpldo3wzIWqOkUS7F9BA=' 
WHERE 
  key_id = '77c661581fe0eee312fb8f8f4e2d9322ebf6594b6918fd88c9b25fc551017f4d' 
  AND (
    token = 'T/N8vYZ2Btg2aGb4tNdeCIyFpldo3wzIWqOkUS7F9BA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017