UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8WkCVlXvqyuxFhohmD74m3jaHkopwCmoF/6NsPY+T5w='
WHERE
key_id = '164a4b40e7358a984218e6ab00769868bf49768473a570f4654ebba3074f4340'
AND (
token = '8WkCVlXvqyuxFhohmD74m3jaHkopwCmoF/6NsPY+T5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)