UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8HrBQKzj99d8S48yMzve5f1krA6Mdq3csNMr+VJBR7Y='
WHERE
key_id = 'ccd00f79df3a1344d553f05c75dac4db46074fa93da8990884fbcd6df6d88489'
AND (
token = '8HrBQKzj99d8S48yMzve5f1krA6Mdq3csNMr+VJBR7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)