UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BELkdeg6cFUpvLRQoXwUxfgZLJUrrpxDPx0t9kS62r4='
WHERE
key_id = '52938d2df38c775fbd4caeee30e7a072131ebc14ef11414453e15c6dfb8602b6'
AND (
token = 'BELkdeg6cFUpvLRQoXwUxfgZLJUrrpxDPx0t9kS62r4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)