UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jCYYrrozy2wzkc8doOg9tO2eUgdRLDBfeRleztQCM6w='
WHERE
key_id = 'bc61cbaeba469d1f951ed4a2f6268e31c49c08ce2c73c0378a77eb7fe4f84421'
AND (
token = 'jCYYrrozy2wzkc8doOg9tO2eUgdRLDBfeRleztQCM6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)