UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P1O/96rtWxfAHOfq2ddlnDGp5vBTALVXKHtQWkakKzk='
WHERE
key_id = 'c6cda20172cdc7f62cd7708463f749cab832239dc03805ad65f605c24e3b3164'
AND (
token = 'P1O/96rtWxfAHOfq2ddlnDGp5vBTALVXKHtQWkakKzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)