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