UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qb/UnvQh9WXrLRYT/WHzsoWmm2FbLlzHMPf18V+Chl0=' 
WHERE 
  key_id = '3a32b88e48062bbde403a88afea6b42681f348c37cefe5fc7e4d23ca8435173c' 
  AND (
    token = 'Qb/UnvQh9WXrLRYT/WHzsoWmm2FbLlzHMPf18V+Chl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040