UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c0fbNnhgCOBukbkGzHCpyE3ivGUUjB/hgcEJiYpy9d8='
WHERE
key_id = 'b5fa57dc3584b7676805080871383fefbb10e4040c9a9d1ed61177076e121923'
AND (
token = 'c0fbNnhgCOBukbkGzHCpyE3ivGUUjB/hgcEJiYpy9d8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)