UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JBgF06yJE/P3bu/37xM8TIw/YuiszOMab39hSA67jNs=' 
WHERE 
  key_id = '3e91e09f010e11e96d13a7dde9667595617e98010162e61df57b48d5e5d520fc' 
  AND (
    token = 'JBgF06yJE/P3bu/37xM8TIw/YuiszOMab39hSA67jNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034