UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k0mKfGOw8B2Kc0ivaX0u4coulpiHTcQtvnBnsxaH1fY='
WHERE
key_id = '8d1bc97ee4eb08cb1d8514412c67b0fe0b9dae531dddea13579d90f4f992dcb2'
AND (
token = 'k0mKfGOw8B2Kc0ivaX0u4coulpiHTcQtvnBnsxaH1fY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)