UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p7yovNbxntxviVwGZqJXJ2tBAku+gSlqtwfA+zq/lL4='
WHERE
key_id = 'c09ddb49a6e5d85b319ebadda133af2d28ef07ee4dd6587c1f6c70a153880ef0'
AND (
token = 'p7yovNbxntxviVwGZqJXJ2tBAku+gSlqtwfA+zq/lL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)