UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0F0MfxghsgcchqmbKtikrHIR/Xdf1/FbxzbP/2W3Fvs=' 
WHERE 
  key_id = '58b51969f183c74b40f70dbf58c7f7e9c3114e35e7a2ce583b33426fc2707520' 
  AND (
    token = '0F0MfxghsgcchqmbKtikrHIR/Xdf1/FbxzbP/2W3Fvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030