UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cG4ODLR3JYbkXsi64DXbBEMma8mYmppzSs6Y7W3HMzQ='
WHERE
key_id = '86786cc148eefcd8468899d0bb40bfdd84b527bdc7b34ba1d6322eae1939ed09'
AND (
token = 'cG4ODLR3JYbkXsi64DXbBEMma8mYmppzSs6Y7W3HMzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)