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