UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jJ3CW+PaAXxqOdz+uRxj71OR5DjsKPxxBEqmhUDwYSM=' 
WHERE 
  key_id = 'ddbd03569868f27aca3030a884e610460f786dc947ba4edfdcb49071f58149da' 
  AND (
    token = 'jJ3CW+PaAXxqOdz+uRxj71OR5DjsKPxxBEqmhUDwYSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082