UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tVbVNd5sbge6Wut4mIbijsxAkbGQ3rx5owO0QSkH+nk='
WHERE
key_id = '7f37101ae4d6832c85ed3f257e0b2a2c2b343d8598ec04f734848bc21998cc79'
AND (
token = 'tVbVNd5sbge6Wut4mIbijsxAkbGQ3rx5owO0QSkH+nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)