UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '79bcbBt1TJKpZHEyRUOUCad24oNVpfhpwjvGRkrDUL0='
WHERE
key_id = '3a555e162a036383b36e60f2bea92f1d8b60905996330f8238e1c25da9e888a1'
AND (
token = '79bcbBt1TJKpZHEyRUOUCad24oNVpfhpwjvGRkrDUL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)