UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UZByDuUkuKBlfuH8OHByzSOZLChJ3W12lSNnR7i2Txo=' 
WHERE 
  key_id = '2ac5fc581f1194bd5390e164bc330a63f50d415c3937ce77ce53fb9b3c1737cc' 
  AND (
    token = 'UZByDuUkuKBlfuH8OHByzSOZLChJ3W12lSNnR7i2Txo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029