UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OT7cEvBnEX4z3R7lZhZeEBQyfr8ab1rkELueheW8iqw=' 
WHERE 
  key_id = '1cf2890648a42efb59a3d441899ae0d2c19031e602c57380719587fc2f1972fb' 
  AND (
    token = 'OT7cEvBnEX4z3R7lZhZeEBQyfr8ab1rkELueheW8iqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051