UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3x6tDurIJYBY7zESC1sj4EzNNHDREutWxl/0XShvKq8='
WHERE
key_id = 'ec20a687d0805ed41d1747b5003603d1428cd4324ea5bde48958cd61495e23fc'
AND (
token = '3x6tDurIJYBY7zESC1sj4EzNNHDREutWxl/0XShvKq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)