UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p+PA+cgOaphSCY01Pw0eMaCxDF6nswc+MQ1ALlCg5s0='
WHERE
key_id = 'cea0e0e48c33df25c561ae076b00cae46227a157a2f6d182a4aab941930d88db'
AND (
token = 'p+PA+cgOaphSCY01Pw0eMaCxDF6nswc+MQ1ALlCg5s0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)