UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hERp7Lpi5rd97L5Lz28r0Ov9dj6e+DV/DUJpH7LgIQ0='
WHERE
key_id = '3d789540406e4cafe077291a75db69517f399452918bab3b45140a01c2a9e516'
AND (
token = 'hERp7Lpi5rd97L5Lz28r0Ov9dj6e+DV/DUJpH7LgIQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)