UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P4lDQ5pghktjzINJgNL8BeQbBYxT2ePDc6hJOANVNI8='
WHERE
key_id = '8fd67890062c173399efbac1286e491899e93f3d9a2f5f2a623356a9f72dbbfd'
AND (
token = 'P4lDQ5pghktjzINJgNL8BeQbBYxT2ePDc6hJOANVNI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)