UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrSgy6zSPPyErgfrjvvT6OeGFYjzao/bLZJ+BO9nTWw='
WHERE
key_id = 'b17f43a357a8314075029518360ced4c95956ecf23d15ce123a7fa4f593639af'
AND (
token = 'KrSgy6zSPPyErgfrjvvT6OeGFYjzao/bLZJ+BO9nTWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)