UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CXiGsbcaTNXFpjpMU6701YE1sr/6u0+0ds+zEfXq7/c=' 
WHERE 
  key_id = '3ce39460227f053d460db537ba70feea27a39853741030af38676577c8ab44ad' 
  AND (
    token = 'CXiGsbcaTNXFpjpMU6701YE1sr/6u0+0ds+zEfXq7/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034