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