UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5OuwXpOKNCoK+aVsP0aUDSAZ+H26Dba27LaLVNHn5Wc='
WHERE
key_id = 'a9861c32acd17c483572345342c30640ddc07195c8100e609c4c47027a609664'
AND (
token = '5OuwXpOKNCoK+aVsP0aUDSAZ+H26Dba27LaLVNHn5Wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)