UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oZYz3mELa5uCBPJ2b8P9s3O06sbQwdtmSk82Y0ryskU='
WHERE
key_id = '050ccd5dcda45b097ab8ed72ee3997ca880be1d865898a65d3df22a41ef261ad'
AND (
token = 'oZYz3mELa5uCBPJ2b8P9s3O06sbQwdtmSk82Y0ryskU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)