UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnJYY8tf2eUolUsEZWio5zIrLmiU66YhGyR1fan2M4c=' 
WHERE 
  key_id = 'e354eb16f9c666a025f6d37190519ef864b87eca6bd0f63fc82d829b777d1472' 
  AND (
    token = 'nnJYY8tf2eUolUsEZWio5zIrLmiU66YhGyR1fan2M4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026