UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I5v0cqInFz05QYdh7EZ44mDX3jjZepRscCGLjupKqh0=' 
WHERE 
  key_id = '332496f319c2afd4afef7f504cb57597e21bd0ee07b1474ee6cef1986919ea53' 
  AND (
    token = 'I5v0cqInFz05QYdh7EZ44mDX3jjZepRscCGLjupKqh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020