UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nFy4WSiFKhLSPkBfV0g591dgIdT5TFNxd/BcdB8/TtI='
WHERE
key_id = '7ba21cbd1b0761cc0d534475245628054ec197949f15b2a9e83cfb5425ca4891'
AND (
token = 'nFy4WSiFKhLSPkBfV0g591dgIdT5TFNxd/BcdB8/TtI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)