UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xmOOPqZ1A2Sn2f9bPFkXMud1msH3nux8dq53gdLmu0w='
WHERE
key_id = 'cb976dbea26684a9d9be73831c23a8362e687b3aa178461291d1e13929e6b82d'
AND (
token = 'xmOOPqZ1A2Sn2f9bPFkXMud1msH3nux8dq53gdLmu0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)