UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'utaIXcj4hi8YCaoTE2uwKBmc02/MzdnOoShisvbB4sc=' 
WHERE 
  key_id = '5e0f9214ba4f395bd4ae8e7f0938c9f918a0497955449f9ac4d3c13a17f9d01c' 
  AND (
    token = 'utaIXcj4hi8YCaoTE2uwKBmc02/MzdnOoShisvbB4sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037