UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sYu32OOUAhIx/YeC3QK5CI+nLVv+9S/Uw0HKVRcWxyg=' 
WHERE 
  key_id = '5c7b7244a040b1283930b95ec4feee76ea9ce15d20a1b6b297cdc02a71bed457' 
  AND (
    token = 'sYu32OOUAhIx/YeC3QK5CI+nLVv+9S/Uw0HKVRcWxyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047