UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MtmU7L2h+1kmbxcf52BaOD71dPt7/A2wwpZjVxLrCUs='
WHERE
key_id = 'fa1048b6e46dd32d1604992ed9dee4cf379c2fd10d9fededd9c297344e898051'
AND (
token = 'MtmU7L2h+1kmbxcf52BaOD71dPt7/A2wwpZjVxLrCUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)