UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/CTThcaHMOs5y7uPr8I2dExspK+uqzlvLGdyEL4khg=' 
WHERE 
  key_id = '57fee64ac3c739f80886377d3b1ce187c4c745339d7625b804e71a6ad9f5f238' 
  AND (
    token = 'p/CTThcaHMOs5y7uPr8I2dExspK+uqzlvLGdyEL4khg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027