UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JaYIcgXiSBN1osHJ3RUCJ88aIi8o672Kd2rTSo22Z/Y=' 
WHERE 
  key_id = '6fd661b2d072a9146c38a8fe8cf96040c7348bd3e62f5a63f14427d8992ecb23' 
  AND (
    token = 'JaYIcgXiSBN1osHJ3RUCJ88aIi8o672Kd2rTSo22Z/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040