UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aK+DfPGrYLyZJIesmCEKZfmPEtqtk8TMGGCwrX+IECk='
WHERE
key_id = '2c2f3b376e3b0b4852d760f139d3202a0d835bb84e76c2c0816c40af5d27c3b5'
AND (
token = 'aK+DfPGrYLyZJIesmCEKZfmPEtqtk8TMGGCwrX+IECk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)